/* $Id: NonClientPersonDomainObjectManagerImpl.java 
 * Copyright (C) 2011, TRAKHEES
 *  
 * Revision History
 *
 * Date  			Author 		    	Remarks
 * ---------------------------------------------------------------------------------
 *
 */
package ae.pcfc.etks.online.common.domain.manager.provider;

import java.util.Collection;

import ae.pcfc.etks.online.common.dao.NonClientPersonDAO;
import ae.pcfc.etks.online.common.domain.ClientPersonReq;
import ae.pcfc.etks.online.common.domain.ClientPersonRoleReq;
import ae.pcfc.etks.online.common.domain.manager.NonClientPersonDomainObjectManager;
import ae.pcfc.etks.online.common.exception.LookupException;
import ae.pcfc.etks.online.common.exception.PersistenceException;

public class NonClientPersonDomainObjectManagerImpl implements	NonClientPersonDomainObjectManager {

	private NonClientPersonDAO nonClientPersonDAO;
	
	
	/**
	 * setNonClientPersonDAO
	 * 
	 * @param nonClientPersonDAO
	 * void
	 */
	public void setNonClientPersonDAO(NonClientPersonDAO nonClientPersonDAO) {
		this.nonClientPersonDAO = nonClientPersonDAO;
	}
	
	/**
	 * add
	 * 
	 * @see ae.pcfc.etks.online.common.domain.manager.BaseDomainObjectManager#add(java.lang.Object)
	 * 
	 */
	public <T> void add(T obj) throws PersistenceException {

		ClientPersonReq clientPersonReq = (ClientPersonReq) obj;
		//As we are storing the client roles as well so, for that we need to set the Client Person in it
		for(ClientPersonRoleReq personRoleReq : clientPersonReq.getClientPersonRoleReqs())
		{
			personRoleReq.setClientPersonReq(clientPersonReq);
		}
		nonClientPersonDAO.add(clientPersonReq);
	}

	/**
	 * update
	 * 
	 * @see ae.pcfc.etks.online.common.domain.manager.BaseDomainObjectManager#update(java.lang.Object)
	 * 
	 */
	public <T> void update(T obj) throws PersistenceException {
		// TODO Auto-generated method stub

	}

	/**
	 * delete
	 * 
	 * @see ae.pcfc.etks.online.common.domain.manager.BaseDomainObjectManager#delete(java.lang.Object)
	 * 
	 */
	public <T> void delete(T obj) throws PersistenceException {
		// TODO Auto-generated method stub

	}

	/**
	 * findByPrimaryKey
	 * 
	 * @see ae.pcfc.etks.online.common.domain.manager.BaseDomainObjectManager#findByPrimaryKey(java.lang.String)
	 * 
	 */
	@SuppressWarnings("unchecked")
	public <T> T findByPrimaryKey(String id) throws LookupException {
		return (T)nonClientPersonDAO.findByPrimaryKey(id);
	}

	/**
	 * findAll
	 * 
	 * @see ae.pcfc.etks.online.common.domain.manager.BaseDomainObjectManager#findAll()
	 * 
	 */
	public <T> Collection<T> findAll() throws LookupException {
		// TODO Auto-generated method stub
		return null;
	}

	/**
	 * getNonClientPersonByApplicationId
	 * 
	 * @see ae.pcfc.etks.online.common.domain.manager.NonClientPersonDomainObjectManager#getNonClientPersonByApplicationId(java.lang.String)
	 * 
	 */
	public ClientPersonReq getNonClientPersonByApplicationId(String applicationId)
			throws LookupException {

		return nonClientPersonDAO.getNonClientPersonByApplicationId(applicationId);
	}

	/**
	 * findByPropertyName
	 * 
	 * @see ae.pcfc.etks.online.common.domain.manager.NonClientPersonDomainObjectManager#findByPropertyName(java.lang.String, java.lang.String)
	 * 
	 */
	public ClientPersonReq findByPropertyName(String propertyName, String propertyValue) {
		return this.nonClientPersonDAO.findByPropertyName(propertyName, propertyValue);
	}

	/**
	 * validateByPropertyName
	 * 
	 * @see ae.pcfc.etks.online.common.domain.manager.NonClientPersonDomainObjectManager#validateByPropertyName(java.lang.String, java.lang.String)
	 * 
	 */
	public boolean validateByPropertyName(String strPropertyName,
			String strPropertyValue) {
		return this.nonClientPersonDAO.validateByPropertyName(strPropertyName, strPropertyValue);
	}

}
